//
//  ZCHotCommentView.m
//  BaiSi
//
//  Created by 张灿 on 16/5/4.
//  Copyright © 2016年 张灿. All rights reserved.
//

#import "ZCHotCommentView.h"
#import "ZCCommentItem.h"
#import "ZCUserItem.h"

@interface ZCHotCommentView ()
@property (weak, nonatomic) IBOutlet UIView *contentView;

//用户名
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;

//用户评论
@property (weak, nonatomic) IBOutlet UILabel *totalContent;

//声音
@property (weak, nonatomic) IBOutlet UIButton *voiceButton;
@end

@implementation ZCHotCommentView

- (void)setItem:(ZCThemeItem *)item
{
    [super setItem:item];
    
    //如果评论字符串长度存在
    if (item.commentItem.content.length) {
        self.totalContent.hidden = NO;
        self.contentView.hidden = YES;
        self.totalContent.text = item.commentItem.totalCotent;
    } else { //显示声音
        self.contentView.hidden = NO;
        self.totalContent.hidden = YES;
        
        self.userNameLabel.text = [NSString stringWithFormat:@"%@:",item.commentItem.user.username];
        [self.voiceButton setTitle:item.commentItem.voicetime forState:UIControlStateNormal];
    }
}

- (void)awakeFromNib
{
    self.autoresizingMask = UIViewAutoresizingNone;
}


@end
